<style lang="less">

</style>

<template>
  <el-dialog :modal-append-to-body="false" title="新增版本" :visible.sync="dialogVisible" size="tiny" class="standard-price-version-add">
    <el-form label-width="100px" ref="form" :model="form">
      <el-form-item label="版本号"
                    prop="name">
        <el-input v-model="form.number" :disabled="true"></el-input>
      </el-form-item>
      <el-form-item label=" 备 注 ">
        <el-input type="textarea" v-model="form.description"></el-input>
      </el-form-item>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button @click="dialogVisible = false">取 消</el-button>
      <el-button type="primary" @click="createform" :loading="loading">确 定</el-button>
    </div>
  </el-dialog>
</template>

<script>
export default {
  name: 'StandardPriceVersionAdd',
  componentName: 'StandardPriceVersionAdd',
  data () {
    return {
      standardPriceId: null,
      dialogVisible: false,
      loading: false,
      form: {
        id: null,
        number: null,
        description: null
      }
    };
  },
  methods: {
    reset: function () {
      if (this.$refs.form) {
        this.$refs.form.resetFields();
      }
      this.$ue.resetObjNull(this.form);
    },
    show (number) {
      this.reset();
      this.form.number = number;
      this.dialogVisible = true;
      this.loading = false;
    },
    hide () {
      this.loading = false;
      this.dialogVisible = false;
    },
    createform () {
      this.$refs.form.validate((valid) => {
        if (valid) {
          let o = Object.assign({}, this.form);
          this.loading = true;
          this.$emit('comfirmSuccess', o);
        }
      });
    }
  },
  mounted () {
  }
};
</script>
